<%--
  Created by IntelliJ IDEA.
  User: ${USER}
  Date: ${DATE}
  Time: ${TIME}
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" isELIgnored="false" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<base href="<%= basePath %>"/>
<!--顶部导航条 -->
<div class="am-container header">
    <ul class="message-l">
        <div class="topMessage">
            <div class="menu-hd">
                <c:if test="${onlineUser!=null}">
                    <c:if test="${onlineUser.customerName!=null}">
                        欢迎用户:&nbsp;${onlineUser.customerName}&nbsp;
                    </c:if>
                    <a id="exit" onclick="exit()" target="_top">退出</a>
                </c:if>
                <c:if test="${onlineUser==null}">
                    <a href="<%= basePath %>/static/business/home/login.jsp" target="_top" class="h">亲，请登录</a>&nbsp;&nbsp;
                </c:if>
                <a href="<%= basePath %>/static/business/home/register.jsp" target="_top">免费注册</a>
            </div>
        </div>
    </ul>
    <ul class="message-r">
        <div class="topMessage home">
            <div class="menu-hd"><a href="index/init" target="_top" class="h">商城首页</a></div>
        </div>
        <div class="topMessage my-shangcheng">
            <div class="menu-hd MyShangcheng"><a href="cntApi/info" target="_top"><i
                    class="am-icon-user am-icon-fw"></i>个人中心</a></div>
        </div>
        <div class="topMessage mini-cart">
            <div class="menu-hd"><a id="mc-menu-hd" href="orderCartApi/queryAllShopCart" target="_top"><i
                    class="am-icon-shopping-cart  am-icon-fw"></i><span>购物车</span></a></div>
        </div>
        <div class="topMessage favorite">
            <div class="menu-hd"><a href="cntApi/myCollection" target="_top"><i
                    class="am-icon-heart am-icon-fw"></i><span>收藏夹</span></a></div>
        </div>
    </ul>
</div>

<!--悬浮搜索框-->

<div class="nav white">
    <div class="logo"><img src="<%= basePath %>/static/business/images/logo.png"/></div>
    <div class="logoBig">
        <li><img src="<%= basePath %>/static/business/images/logobig.png"/></li>
    </div>

    <div class="search-bar pr">
        <form>
            <input id="searchInput" name="keywords" type="text" placeholder="搜索" autocomplete="off"
                   value="${keywords}">
            <input id="ai-topsearch" class="submit am-btn" value="搜索" index="1" type="button" onclick="searchGoods();">
        </form>
    </div>
</div>
<div class="clear"></div>
<script>
    function exit() {
        if (window.confirm("是否确认退出？")) {
            alert("退出成功")
            window.location.href = "cntApi/loginOut";
        }
    }

    //搜索商品
    function searchGoods() {
        var keywords = $("#searchInput").val();
        location.href = "goodsIndexApi/queryGoodsByParam/1?keywords=" + keywords;
    }
</script>